!function(window) {
	
	var document = window.document,
		$ = window.__jipin_$;
	
	window.__jipin_getSitePicDesc = function(targetPic) {
		var picDesc = {'title' : $(targetPic).attr('alt') || '', 'price' : ''};
		try {
			if($('#PinCaption').length) {
				var capClone = $('#PinCaption').clone();
				capClone.children('p').remove();
				picDesc.title = $.trim(capClone.text());
			}
		} catch(e) {}
    	return picDesc;
	}
	
	// 获得基础JIPIN对象
	var JIPIN = window.__NS__JIPIN;
	if(!JIPIN) { return; }
	
	JIPIN._fixImage = JIPIN.fixImage;
	JIPIN._refixImage = JIPIN.refixImage;
	
	JIPIN.getSourceURL = function(targetPic) {
		var url = document.location.href;
		if(targetPic.hasClass('PinImageImg')) {
			url = targetPic.parent().get(0).href; 
		}
		return url;
	};
	
	JIPIN.fixImage = function(image, callback) {
		if($(image).hasClass('PinImageImg') && image.src.search(/_b\.jpg$/) !== -1) {
			callback(image);
		} else {
			this._fixImage(image, callback);
		}
	};
	
	JIPIN.refixImage = function(image, callback) {
		if($(image).hasClass('PinImageImg') && image.src.search(/_b\.jpg$/) !== -1) {
			callback(image);
		} else {
			this._refixImage(image, callback);
		}
	};
	
	window.__jipin_sitedata = window.__jipin_getSitePicDesc();

}(window);
